﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DiamondDesktop.Views;
namespace DiamondDesktop.Presenters
{
    class SystemTimer : DiamondDesktop.Presenters.AbstractTimer
    {

        System.Timers.Timer t = new System.Timers.Timer();

        public SystemTimer()
        {
            t.Elapsed += new System.Timers.ElapsedEventHandler(timeUp);
            t.Stop();
        }

        public override void start()
        {
            t.Start();
        }

        public override void stop()
        {
            t.Stop();
        }

        public override void setInterval(long seconds)
        {
            if(seconds > 0)
                  t.Interval = 1000 * seconds;
        }

        private void timeUp(object sender, System.Timers.ElapsedEventArgs e)
        {
             this.notifyObservers();
        }

    }
}
